package util.ip;

import java.util.HashSet;
import java.util.Set;

public class ProFilter {
	
	String[] tcp = {"tcp", "msnms"};
	String[] http = {"http"};
	String[] https = {"ssl", "tlsv1", "tlsv1.2"};
	String[] udp = {"dns", "udp", "icmp", "ntp", "dhcp", "bootp"};
	
	protected Set<String> legalSet = new HashSet<String>();
	Set<String> tcpSet = new HashSet<String>();
	Set<String> httpSet = new HashSet<String>();
	Set<String> httpsSet = new HashSet<String>();
	Set<String> udpSet = new HashSet<String>();


	
	
	public Set<String> getTcp() {
		
		return tcpSet;
		
	}
	
	public Set<String> getHttp() {
		return httpSet;
	}
	
	public Set<String> getHttps() {
		return httpsSet;
	}
	
	public Set<String> getUdp() {
		return udpSet;
	}
	
	public ProFilter() {
		for (String string : tcp) {
			tcpSet.add(string);
		}
		
		for (String string : http) {
			httpSet.add(string);
		}
		
		for (String string : https) {
			httpsSet.add(string);
		}
		
		for (String string : udp) {
			udpSet.add(string);
		}
		
		legalSet.addAll(tcpSet);
		legalSet.addAll(httpSet);
		legalSet.addAll(httpsSet);
		legalSet.addAll(udpSet);
			
	}
	
	
	public boolean isLegal(String protocol) {
		
		return legalSet.contains(protocol.toLowerCase());
		
	}

}
